/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package sv.org.auditoria.renta.entity;

import java.io.Serializable;
import java.math.BigDecimal;
import java.math.BigInteger;
import java.util.Date;
import java.util.List;
import javax.persistence.Basic;
import javax.persistence.CascadeType;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.NamedQueries;
import javax.persistence.NamedQuery;
import javax.persistence.OneToMany;
import javax.persistence.Table;
import javax.persistence.Temporal;
import javax.persistence.TemporalType;
import javax.validation.constraints.NotNull;
import javax.xml.bind.annotation.XmlRootElement;
import javax.xml.bind.annotation.XmlTransient;

/**
 *
 * @author HP
 */
@Entity
@Table(name = "INGRESOS", catalog = "", schema = "")
@XmlRootElement
@NamedQueries({
    @NamedQuery(name = "Ingresos.findAll", query = "SELECT i FROM Ingresos i"),
    @NamedQuery(name = "Ingresos.findByIdingresos", query = "SELECT i FROM Ingresos i WHERE i.idingresos = :idingresos"),
    @NamedQuery(name = "Ingresos.findByFechaingresos", query = "SELECT i FROM Ingresos i WHERE i.fechaingresos = :fechaingresos"),
    @NamedQuery(name = "Ingresos.findByMontoingresos", query = "SELECT i FROM Ingresos i WHERE i.montoingresos = :montoingresos")})
public class Ingresos implements Serializable {
    private static final long serialVersionUID = 1L;
    // @Max(value=?)  @Min(value=?)//if you know range of your decimal fields consider using these annotations to enforce field validation
    @Id
    @Basic(optional = false)
    @NotNull
    @Column(name = "IDINGRESOS")
    private BigDecimal idingresos;
    @Column(name = "FECHAINGRESOS")
    @Temporal(TemporalType.TIMESTAMP)
    private Date fechaingresos;
    @Column(name = "MONTOINGRESOS")
    private BigInteger montoingresos;
    @OneToMany(cascade = CascadeType.ALL, mappedBy = "ingresosIdingresos")
    private List<Declaraciones> declaracionesList;
    @JoinColumn(name = "TIPOINGRESOS_IDTIPOINGRESOS", referencedColumnName = "IDTIPOINGRESOS")
    @ManyToOne(optional = false)
    private Tipoingresos tipoingresosIdtipoingresos;

    public Ingresos() {
    }

    public Ingresos(BigDecimal idingresos) {
        this.idingresos = idingresos;
    }

    public BigDecimal getIdingresos() {
        return idingresos;
    }

    public void setIdingresos(BigDecimal idingresos) {
        this.idingresos = idingresos;
    }

    public Date getFechaingresos() {
        return fechaingresos;
    }

    public void setFechaingresos(Date fechaingresos) {
        this.fechaingresos = fechaingresos;
    }

    public BigInteger getMontoingresos() {
        return montoingresos;
    }

    public void setMontoingresos(BigInteger montoingresos) {
        this.montoingresos = montoingresos;
    }

    @XmlTransient
    public List<Declaraciones> getDeclaracionesList() {
        return declaracionesList;
    }

    public void setDeclaracionesList(List<Declaraciones> declaracionesList) {
        this.declaracionesList = declaracionesList;
    }

    public Tipoingresos getTipoingresosIdtipoingresos() {
        return tipoingresosIdtipoingresos;
    }

    public void setTipoingresosIdtipoingresos(Tipoingresos tipoingresosIdtipoingresos) {
        this.tipoingresosIdtipoingresos = tipoingresosIdtipoingresos;
    }

    @Override
    public int hashCode() {
        int hash = 0;
        hash += (idingresos != null ? idingresos.hashCode() : 0);
        return hash;
    }

    @Override
    public boolean equals(Object object) {
        // TODO: Warning - this method won't work in the case the id fields are not set
        if (!(object instanceof Ingresos)) {
            return false;
        }
        Ingresos other = (Ingresos) object;
        if ((this.idingresos == null && other.idingresos != null) || (this.idingresos != null && !this.idingresos.equals(other.idingresos))) {
            return false;
        }
        return true;
    }

    @Override
    public String toString() {
        return "sv.org.auditoria.renta.entity.Ingresos[ idingresos=" + idingresos + " ]";
    }
    
}
